package com.yanqu.road.server.gameplayer.module.player;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yanqu.road.entity.curio.enums.eCurioConditionType;
import com.yanqu.road.entity.log.LogCardDailyReward;
import com.yanqu.road.entity.log.LogSubscribe;
import com.yanqu.road.entity.recharge.RechargeOrder;
import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.enums.*;
import com.yanqu.road.logic.bussiness.player.UserCardBussiness;
import com.yanqu.road.logic.config.GameConfig;
import com.yanqu.road.logic.config.ServerConfig;
import com.yanqu.road.entity.activity.CardPrivilege;
import com.yanqu.road.entity.enums.eCardType;
import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.entity.enums.eMailType;
import com.yanqu.road.entity.enums.eMessageType;
import com.yanqu.road.entity.player.UserCard;
import com.yanqu.road.pb.activity.CardProto;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.curio.CurioModule;
import com.yanqu.road.server.gameplayer.module.base.GeneralModule;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.ConfigMgr;
import com.yanqu.road.server.manger.MultipleLanguageMgr;
import com.yanqu.road.server.manger.activity.curio.CurioMgr;
import com.yanqu.road.server.manger.log.AutoLogMgr;
import com.yanqu.road.server.manger.activity.oldplayerreturn.OldPlayerReturnMgr;
import com.yanqu.road.server.manger.log.LogMgr;
import com.yanqu.road.server.manger.player.PrivilegeCardMgr;
import com.yanqu.road.server.manger.player.WorldMessageMgr;
import com.yanqu.road.server.pb.ActivityPb;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.LocalDateTimeHelper;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.text.MessageFormat;

public class CardModule extends GeneralModule {

	private UserCard userCard;

	public CardModule(GamePlayer player) {
		super(player);
	}

	@Override
	public boolean afterLoadData() {
		return false;
	}

	@Override
	public boolean loadData() {
		userCard = UserCardBussiness.getUserCard(player.getUserId());
		initUserCard();
		return true;
	}

	@Override
	public boolean saveData() {
		if (userCard.isInsertOption()) {
			UserCardBussiness.addUserCard(userCard);
		}else if (userCard.isUpdateOption()) {
			UserCardBussiness.updateUserCard(userCard);
		}
		return true;
	}

	@Override
	public void loginSendMsg() {
		syncUserCard();
		autoSendReward();
	}

	public void autoSendReward(){
		if(ServerConfig.PRIVILEGE_CARD_AUTO_SEND_REWARD > 0) {
			if (null != userCard) {
				long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
				long yesterdayTime = zeroTime - DateHelper.DAY_SECONDS;
				//月卡奖励
				autoSendMonthCardReward(zeroTime, yesterdayTime);
				//年卡奖励
				autoSendYearCardReward(zeroTime, yesterdayTime);
			}
		}
	}

	private void autoSendYearCardReward(long zeroTime, long yesterdayTime) {
		long offsetTime;
		long day;
		Property reward;
		CardPrivilege cardPrivilege;
		String rewardStr;
		if(userCard.getGetYearCardRewardTime() < yesterdayTime && userCard.getGetYearCardRewardTime() < userCard.getYearCardEndTime()){
			long tempTime = zeroTime - 1;       //前一天
			long recordTime = yesterdayTime;
			if(userCard.getYearCardEndTime() < yesterdayTime){
				tempTime = userCard.getYearCardEndTime();
				recordTime = userCard.getYearCardEndTime();
			}
			offsetTime = tempTime - userCard.getGetYearCardRewardTime();
			day = offsetTime / DateHelper.DAY_SECONDS;
			if(day > PrivilegeCardMgr.PRIVILEGE_CARD_YEAR_DAY){
				day = PrivilegeCardMgr.PRIVILEGE_CARD_YEAR_DAY;
			}
			if(day > 0) {
				reward = new Property();
				cardPrivilege = ConfigMgr.getCardPrivilege(eCardType.YearCard.getValue());
				//每日元宝
				reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(cardPrivilege.getDailyGetIngots() * day));
				reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(CurioMgr.getSkillAdditionBySkillType(eSkillType.CurioYearCardIngotsAddSkill.getValue(), player, 0) * day));
				//每日银两收益
				BigInteger silver = player.getModule(EarnSpeedModule.class).getEarnSpeed().multiply(BigInteger.valueOf(3600 *
						cardPrivilege.getDailyGetSilverTimeParam() * day));
				reward.addProperty(GameConfig.GAME_MONEY_SILVER, silver);
				rewardStr = PropertyHelper.parsePropertyToString(reward);
				if (!StringUtils.isNullOrEmpty(rewardStr)) {
					userCard.setGetYearCardRewardTime(recordTime);
					String mailTitle = MultipleLanguageMgr.getContent(MailManager.YEAR_CARD_REWARD_TITLE, player.getLanguage());
					String mailContent = StringUtils.format(MultipleLanguageMgr.getContent(MailManager.YEAR_CARD_REWARD_CONTENT, player.getLanguage()), day);
					MailManager.sendMailOnLoad(player, eMailType.SYSTEM.getValue(), rewardStr, mailContent, mailTitle);
				}else {
					log.error("auto send year reward, reward is empty");
				}
				AutoLogMgr.add(new LogCardDailyReward(player.getUserId(), eCardType.YearCard.getValue(), true, (int) day, rewardStr));
			}
		}
	}

	private void autoSendMonthCardReward(long zeroTime, long yesterdayTime) {
		long offsetTime;
		long day;
		Property reward;
		CardPrivilege cardPrivilege;
		String rewardStr;
		if(userCard.getGetMonthCardRewardTime() < yesterdayTime && userCard.getGetMonthCardRewardTime() < userCard.getMonthCardEndTime()){
			long tempTime = zeroTime - 1;   //前一天
			long recordTime = yesterdayTime;
			if(userCard.getMonthCardEndTime() < yesterdayTime){
				tempTime = userCard.getMonthCardEndTime();
				recordTime = userCard.getMonthCardEndTime();
			}
			offsetTime = tempTime - userCard.getGetMonthCardRewardTime();
			day = offsetTime / DateHelper.DAY_SECONDS;
			if(day > PrivilegeCardMgr.PRIVILEGE_CARD_MONTH_DAY){
				day = PrivilegeCardMgr.PRIVILEGE_CARD_MONTH_DAY;
			}
			if(day > 0) {
				reward = new Property();
				cardPrivilege = ConfigMgr.getCardPrivilege(eCardType.MonthCard.getValue());
				//每日元宝
				reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(cardPrivilege.getDailyGetIngots() * day));
				reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(CurioMgr.getSkillAdditionBySkillType(eSkillType.CurioMonthCardIngotsAddSkill.getValue(), player, 0) * day));
				//每日银两收益
				BigInteger silver = player.getModule(EarnSpeedModule.class).getEarnSpeed().multiply(BigInteger.valueOf(3600 * cardPrivilege.getDailyGetSilverTimeParam() * day));
				reward.addProperty(GameConfig.GAME_MONEY_SILVER, silver);
				rewardStr = PropertyHelper.parsePropertyToString(reward);
				if (!StringUtils.isNullOrEmpty(rewardStr)) {
					userCard.setGetMonthCardRewardTime(recordTime);
					String mailTitle = MultipleLanguageMgr.getContent(MailManager.MONTH_CARD_REWARD_TITLE, player.getLanguage());
					String mailContent = StringUtils.format(MultipleLanguageMgr.getContent(MailManager.MONTH_CARD_REWARD_CONTENT, player.getLanguage()), day);
					MailManager.sendMailOnLoad(player, eMailType.SYSTEM.getValue(), rewardStr, mailContent, mailTitle);
				}else {
					log.error("auto send month reward, reward is empty");
				}
				AutoLogMgr.add(new LogCardDailyReward(player.getUserId(), eCardType.MonthCard.getValue(), true, (int) day, rewardStr));
			}
		}
	}

	//试用七天的月卡 只有一个地方调用
	public void oldPlayerCardTrial() {
		if (userCard == null) {
			return;
		}
		long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
		long yesterdayTime = zeroTime - DateHelper.DAY_SECONDS;
		long endTime = System.currentTimeMillis() / 1000;
		if (userCard.getMonthCardEndTime() > endTime) {
			endTime = userCard.getMonthCardEndTime();
		}
        ActivityConfig card_free_time = OldPlayerReturnMgr.getActivityConfig("RETURN_TASK_MONTHLY_CARD_FREE_TIME");
        if (card_free_time == null) {
            userCard.setMonthCardEndTime(endTime + 7 * DateHelper.DAY_SECONDS);
        } else {
            userCard.setMonthCardEndTime(endTime + card_free_time.getIntValue());
        }

		if (userCard.getGetMonthCardRewardTime() >= zeroTime) {
			userCard.setGetMonthCardRewardTime(userCard.getGetMonthCardRewardTime() - DateHelper.DAY_SECONDS);
		} else {
			userCard.setGetMonthCardRewardTime(yesterdayTime);
		}
		syncUserCard();
		player.getModule(ChildModule.class).calcAndSyncChildSite();
	}

	private void initUserCard() {
		if(null == userCard) {
			UserCard card = new UserCard();
			card.setUserId(player.getUserId());
			card.setMonthCardEndTime(0);
			card.setGetMonthCardRewardTime(0);
			card.setYearCardEndTime(0);
			card.setGetYearCardRewardTime(0);
			card.setInsertOption();
			userCard = card;
		}
	}

	private void syncUserCard(){
		CardProto.PrivilegeCardMsg.Builder msg = ActivityPb.parsePrivilegeCardMsg(userCard);
		if(null != msg){
			player.sendPacket(Protocol.U_CARD_SYNC, msg);
		}
	}

	/**
	 * 是否领取特权卡奖励
	 */
	public boolean hasGetReward(int cardType) {
		if(null == userCard){
			return true;
		}
		long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
		if (cardType == eCardType.MonthCard.getValue()) {
			return userCard.getGetMonthCardRewardTime() >= zeroTime;
		}else if (cardType == eCardType.YearCard.getValue()) {
			return userCard.getGetYearCardRewardTime() >= zeroTime;
		}
		return true;
	}

	/**
	 * 返回特权卡是否在有效期内
	 */
	public boolean isInCardTime(int cardType) {
		return PrivilegeCardMgr.isInCardTime(userCard, cardType);
	}

	/**
	 * 是否能够购买周卡
	 */
	public boolean canBuyCard(int cardType) {
		return PrivilegeCardMgr.canBuyCard(userCard, cardType);
	}

	public String addCard(int cardType, boolean isSendReward, int mallId, RechargeOrder rechargeOrder) {
		long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp() / 1000;
		long yesterdayTime = zeroTime - DateHelper.DAY_SECONDS;
		long endTime = System.currentTimeMillis() / 1000;
		String reward = "";
		if (eCardType.MonthCard.getValue() == cardType) {//月卡
			if (userCard.getMonthCardEndTime() > endTime) {
				endTime = userCard.getMonthCardEndTime();
			}
			userCard.setMonthCardEndTime(endTime + PrivilegeCardMgr.PRIVILEGE_CARD_MONTH_DAY * DateHelper.DAY_SECONDS);
			if(userCard.getGetMonthCardRewardTime() >= zeroTime) {
				userCard.setGetMonthCardRewardTime(userCard.getGetMonthCardRewardTime() - DateHelper.DAY_SECONDS);
			}else {
				userCard.setGetMonthCardRewardTime(yesterdayTime);
			}
			syncUserCard();
			player.getModule(ChildModule.class).calcAndSyncChildSite();
			player.notifyListener(eGamePlayerEventType.TotalBuyMonthCardTime.getValue(), 1);
			WorldMessageMgr.worldNotify(player, eMessageType.BuyWeekCard.getValue());
		}else if (eCardType.YearCard.getValue() == cardType) {//年卡
			if (userCard.getYearCardEndTime() > endTime) {
				endTime = userCard.getYearCardEndTime();
			}
			userCard.setYearCardEndTime(endTime + PrivilegeCardMgr.PRIVILEGE_CARD_YEAR_DAY * DateHelper.DAY_SECONDS);
			if(userCard.getGetYearCardRewardTime() >= zeroTime) {
				userCard.setGetYearCardRewardTime(userCard.getGetYearCardRewardTime() - DateHelper.DAY_SECONDS);
			}else {
				userCard.setGetYearCardRewardTime(yesterdayTime);
			}
			syncUserCard();
			WorldMessageMgr.worldNotify(player, eMessageType.BuyLifeCard.getValue());
		}else if (eCardType.WeekCard.getValue() == cardType) {//周卡
			if(GameConfig.PRIVILEGE_WEEK_CARD_MALL_ID == mallId) {//直购周卡
				if (userCard.getWeekCardEndTime() > endTime) {
					endTime = userCard.getWeekCardEndTime();
				}
				userCard.setWeekCardEndTime(endTime + PrivilegeCardMgr.PRIVILEGE_CARD_WEEK_DAY * DateHelper.DAY_SECONDS);
				syncUserCard();
			}else {//订阅周卡
				if(null == rechargeOrder || StringUtils.isNullOrEmpty(rechargeOrder.getSubscription())){
					log.error("add week card error,subscription is empty");
				}else {
					JSONObject dataObj = JSON.parseObject(rechargeOrder.getSubscription());
					int type = dataObj.getIntValue("type");
					boolean isFree = dataObj.getBoolean("isFree");
					long expiresTime = dataObj.getLong("expiresDate");
					player.getModule(RechargeModule.class).addSubscribe(mallId, type, isFree, expiresTime, rechargeOrder.getSdkOrderNo());
					if (0 == type || 1 == type) {
						if (isFree) {//试用
							userCard.setWeekCardExperiment(true);
							if (userCard.getWeekCardEndTime() > endTime) {
								endTime = userCard.getWeekCardEndTime();
							}
							userCard.setWeekCardEndTime(endTime + ConfigMgr.getWeekCardExperimentDay() * DateHelper.DAY_SECONDS);
						} else {
							if (userCard.getWeekCardEndTime() > endTime) {
								endTime = userCard.getWeekCardEndTime();
							}
							userCard.setWeekCardEndTime(endTime + PrivilegeCardMgr.PRIVILEGE_CARD_WEEK_DAY * DateHelper.DAY_SECONDS);
						}
						syncUserCard();
					}
					AutoLogMgr.add(new LogSubscribe(player.getUserId(), mallId, type, rechargeOrder.getOrderNo(), rechargeOrder.getSdkOrderNo(),
							isFree, expiresTime));
				}
			}
		}

		if(isSendReward) {
			if(eCardType.MonthCard.getValue() == cardType || eCardType.YearCard.getValue() == cardType) {
				//领取特权卡，马上收益奖励
				CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
				if (null != cardPrivilege) {
					Property ingotReward = new Property(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(cardPrivilege.getBuyGetIngots()));
					player.getModule(CurrencyModule.class).addCurrency(ingotReward, eLogMoneyType.Activity, eLogMoneyType.CardReward);
					reward = PropertyHelper.parsePropertyToString(ingotReward);
				}
			}
		}
		player.getModule(EarnSpeedModule.class).scheduleAddSilver();
		return reward;
	}


	/**
	 * 特权卡领取收益
	 */
	public Property getReward(int cardType) {
		long nowTime = System.currentTimeMillis() / 1000;
		Property reward = new Property();
		CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
		if(null == cardPrivilege){
			return reward;
		}
		if(eCardType.WeekCard.getValue() == cardType){
			return reward;
		}
		//每日元宝
		reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(cardPrivilege.getDailyGetIngots()));
		//每日银两收益
		BigInteger silver = player.getModule(EarnSpeedModule.class).getEarnSpeed().multiply(BigInteger.valueOf(3600 * cardPrivilege.getDailyGetSilverTimeParam()));
		reward.addProperty(GameConfig.GAME_MONEY_SILVER, silver);
		if (eCardType.MonthCard.getValue() == cardType) {
			userCard.setGetMonthCardRewardTime(nowTime);
			reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(CurioMgr.getSkillAdditionBySkillType(eSkillType.CurioMonthCardIngotsAddSkill.getValue(), player, 0)));
			player.getModule(CurioModule.class).addUserCurioCountData(eCurioConditionType.GetMonthCardRewardTime.getType(), 1);
		}else if (eCardType.YearCard.getValue() == cardType) {
			userCard.setGetYearCardRewardTime(nowTime);
			player.notifyListener(eGamePlayerEventType.TotalReceiveYearCardRewardTime.getValue(),1);
			reward.addProperty(GameConfig.GAME_MONEY_INGOTS, BigInteger.valueOf(CurioMgr.getSkillAdditionBySkillType(eSkillType.CurioYearCardIngotsAddSkill.getValue(), player, 0)));
			player.getModule(CurioModule.class).addUserCurioCountData(eCurioConditionType.GetYearCardRewardTime.getType(), 1);
		}
		//奖励入口袋
		player.getModule(CurrencyModule.class).addCurrency(reward, eLogMoneyType.Activity, eLogMoneyType.CardDailyGetReward);
		AutoLogMgr.add(new LogCardDailyReward(player.getUserId(), cardType, false, 1, PropertyHelper.parsePropertyToString(reward)));
		return reward;
	}

	/**
	 * 特权卡赚速加成
	 */
	public int getEarnSpeedAddition() {
		int addition = 0;
		int cardType = eCardType.MonthCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			addition += cardPrivilege.getEarnSpeedAddition();
		}
		cardType = eCardType.YearCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			addition += cardPrivilege.getEarnSpeedAddition();
		}
		cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			addition += cardPrivilege.getEarnSpeedAddition();
		}
		return addition;
	}

	/**
	 * 子嗣席位培养上限增加次数
	 */
	public int childSiteTrainAddTimes() {
		int times = 0;
		int cardType = eCardType.MonthCard.getValue();
		if (isInCardTime(cardType)) {
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getAddChildSiteTrainTimes();
		}
		return times;
	}

	/**
	 * 商战随机出战恢复轮次
	 */
	public int tradeWarRandomBattleAddRestoreTimes(){
		int times = 0;
		int cardType = eCardType.MonthCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getAddTradeWarRandomBattleRestoreTimes();
		}
		return times;
	}

	public int mineWarAddBattleTimes(){
		int times = 0;
		int cardType = eCardType.YearCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getAddMineWarBattleTimes();
		}
		return times;
	}

	public int oreWarAddBattleTimes(){
		int times = 0;
		int cardType = eCardType.YearCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getAddMineWarBattleTimes();
		}
		return times;
	}

	public boolean isTaxOfficeOutputNoLimit(){
		boolean result = false;
		int cardType = eCardType.YearCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = cardPrivilege.isTaxOfficeOutputNoLimit();
		}
		return result;
	}

	/**
	 * 中级建设免费
	 */
	public boolean isUnionConstructMidFree(){
		boolean result = false;
		int cardType = eCardType.MonthCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = (cardPrivilege.getUnionConstructFreeType() == 1);
		}
		if(!result){
			cardType = eCardType.YearCard.getValue();
			if(isInCardTime(cardType)){
				CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
				result = (cardPrivilege.getUnionConstructFreeType() == 1);
			}
		}
		return result;
	}

	/**
	 * 高级建设免费
	 */
	public boolean isUnionConstructSupFree(){
		boolean result = false;
		int cardType = eCardType.MonthCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = (cardPrivilege.getUnionConstructFreeType() == 2);
		}
		if(!result){
			cardType = eCardType.YearCard.getValue();
			if(isInCardTime(cardType)){
				CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
				result = (cardPrivilege.getUnionConstructFreeType() == 2);
			}
		}
		return result;
	}

	public boolean isOneKeyTrainChild(){
		boolean result = false;
		int cardType = eCardType.YearCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = cardPrivilege.isOneKeyTrainChild();
		}
		return result;
	}

	/**
	 * 是否一键处理关卡的事件
	 * @return
	 */
	public boolean isOneKeyDealPassRoadEvent(){
		boolean result = false;
		int cardType = eCardType.MonthCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = cardPrivilege.isOneKeyDealPassRoadEvent();
		}
		return result;
	}

	public UserCard getUserCard() {
		return userCard;
	}

	/**
	* 描述：关卡是否一键通关
	* 作者：zrq
	* 时间：2023/3/9
	* 参数：

	* 返回值：
	**/
	public boolean isPassRoadOneKeyPass(){
		boolean result = false;
		int cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = cardPrivilege.isPassRoadOneKeyPass();
		}
		return result;
	}

	/**
	* 描述：前几次传唤双胞胎
	* 作者：zrq
	* 时间：2023/3/9
	* 参数：

	* 返回值：
	**/
	public boolean isTrystMakeDoubleChild(long trystTimes){
		int times = 0;
		int cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getTrystMakeDoubleChildTimes();
		}
		return times > trystTimes;
	}

	/**
	* 描述：子嗣一键培养（包含一键所有）
	* 作者：zrq
	* 时间：2023/3/9
	* 参数：

	* 返回值：
	**/
	public boolean isOneKeyTrainAllChild(){
		boolean result = false;
		int cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			result = cardPrivilege.isOneKeyTrainAllChild();
		}
		return result;
	}

	/**
	* 描述：前几次子嗣培养声望奖励翻倍
	* 作者：zrq
	* 时间：2023/3/14
	* 参数：游历次数是未执行游历的次数

	* 返回值：
	**/
	public boolean travelPrestigeDouble(long travelTimes){
		int times = 0;
		int cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			times = cardPrivilege.getTravelPrestigeDoubleTimes();
		}
		return times > travelTimes;
	}

	/**
	* 描述：子嗣培养阅历加成
	* 作者：zrq
	* 时间：2023/3/14
	* 参数：

	* 返回值：
	**/
	public int getChildTrainPatronsExpAddition() {
		int addition = 0;
		int cardType = eCardType.WeekCard.getValue();
		if(isInCardTime(cardType)){
			CardPrivilege cardPrivilege = ConfigMgr.getCardPrivilege(cardType);
			addition += cardPrivilege.getChildTrainPatronsExpAddition();
		}
		return addition;
	}
}
